﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;

namespace MotionControl.Core
{
    internal class XMLConfig
    {
        void LoadPLCConfg()
        { 
            XmlDocument doc = new XmlDocument();
            doc.Load("data/plc_confg.json");
            // 读取配置
            XmlNode setting1Node = doc.SelectSingleNode("/config/plc/add[@key='setting1']");
            string setting1Value = setting1Node.Attributes["value"].Value;
            Console.WriteLine($"Setting1: {setting1Value}");

            // 修改配置
            setting1Node.Attributes["value"].Value = "newValue1";
        }
    }
}
